package com.thirteen.app.daoTest;

import com.thirteen.app.dto.QuestionAnswerDto;
import com.thirteen.app.entity.Answer;
import com.thirteen.app.entity.Question;
import com.thirteen.app.entity.QuestionRepository;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface QuestionRepositoryDao {

    //新增题库
    int insert(@Param("questionrepository") QuestionRepository questionrepository);

    //以下三个方法用于向指定题库添加题目
    int insertQu(@Param("question") Question question);

    int insertRepositoryQuestion(@Param("repositoryId") Integer repositoryId, @Param("questionType") Integer questionType, @Param("questionId") Integer questionId);

    int insertAnswer(@Param("list") List<Answer> list);

    //根据题目类型和题库id查询题目
    List<QuestionAnswerDto> selectQuByType(@Param("repositoryId") Integer repositoryId, @Param("questionType") Integer[] questionType);

    //该方法用于删除指定题库的指定题目
    int updateRepositoryQuestion(@Param("questionId") Integer questionId, @Param("repositoryId") Integer repositoryId);

    //根据题库名称模糊查询所有题库
    List<QuestionRepository> selectAllQsBank(@Param("title") String title);

    int updateQuestion(@Param("content") String content,
                       @Param("questionId") Integer questionId,
                       @Param("answerCount") Integer answerCount,
                       @Param("analysis") String analysis);

    int updateQuestionAnswer(
            @Param("content") String content,
            @Param("tag") String tag,
            @Param("isRight") boolean isRight,
            @Param("questionId") Integer questionId);

    int deleteALlAnswer(@Param("questionId") Integer questionId);
}

